package com.example.administrator.baikangxing.holder;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import com.example.administrator.baikangxing.MyApplication;
import com.example.administrator.baikangxing.R;
import com.example.administrator.baikangxing.bean.BindDevice;

import java.util.Random;

import cn.carbs.android.avatarimageview.library.AvatarImageView;

/**
 * Created by Sushil_Shen on 2017/5/16/0016.
 * Contact: Sushil_shen@163.com
 */

public class CallHolder extends BaseHolder<BindDevice> {

    private TextView watch_tv_name;
    private AvatarImageView watch_image_head;

    @Override
    protected View getHolderView() {
        View view = View.inflate(MyApplication.context, R.layout.watch_layout_item, null);
        watch_image_head = (AvatarImageView) view.findViewById(R.id.watch_image_head);
        watch_tv_name = (TextView) view.findViewById(R.id.watch_tv_name);
        return view;
    }

    @Override
    public void bindData(BindDevice bindDevice) {
        watch_image_head.setTextAndColor(bindDevice.getNickname().substring(0,1),AvatarImageView.COLORS[new Random().nextInt(6)]);
        watch_tv_name.setText(bindDevice.getNickname()+"的手表");
    }
}
